*! version 1.0.0  21apr2020
program define mclogit_p, sort
    version 15
 
    syntax newvarname [if] [in] , [ xb pr]
 
    marksample touse, novarlist
 
    local nopts : word count `xb' `pr'
    if `nopts' >1 {
        display "{err}only one statistic may be specified"
        exit 498
    }
 
    if `nopts' == 0 {
        local pr pr
        display "Pr(y=1)"
    }
 
    if "`xb'" != "" {
        _predict `typlist' `varlist' if `touse', xb
    }
    else {
        tempvar xbv
        quietly _predict double `xbv' if `touse', xb
        generate `typlist' `varlist' = logistic(`xbv') if `touse'
    }
end